#ifndef MANAGER_WIDGET_H
#define MANAGER_WIDGET_H

#include <QWidget>
#include <QPushButton>
#include <QLineEdit>
#include <QLabel>
#include <QProgressBar>
#include <QSettings>
#include <QUdpSocket>

QT_BEGIN_NAMESPACE
namespace Ui { class ManagerWidget; }
QT_END_NAMESPACE

class ManagerWidget : public QWidget
{
    Q_OBJECT

public:
    ManagerWidget(QWidget *parent = nullptr);
    ~ManagerWidget();

private slots:
    void selectFile();
    void uploadFileToOSS();
    void showConfigDialog();
    void sendUdpCommand(const QString& command);
    void onClientStatusReceived(const QString& status);

private:
    Ui::ManagerWidget *ui;

    // UI组件
    QLineEdit *filePathEdit;
    QLineEdit *remoteNameEdit;
    QPushButton *selectButton;
    QPushButton *uploadButton;
    QPushButton *configButton;
    QPushButton *playButton;
    QPushButton *stopButton;
    QPushButton *downloadButton;
    QPushButton *statusButton;
    QProgressBar *progressBar;
    QLabel *statusLabel;
    QLabel *clientStatusLabel;

    QString currentFilePath;
    QString configFilePath;
    QUdpSocket *udpSocket;

    void loadConfig();
    void saveConfig(const QString& accessKeyId, const QString& accessKeySecret);
    QString getAccessKeyId();
    QString getAccessKeySecret();
    bool checkConfig();
};
#endif // MANAGER_WIDGET_H
